package com.winterchen.config;

import com.winterchen.interceptor.HomeResourceInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;


//添加拦截器
//将此类设置为springmvc配置

@Configuration
public class BaseInterceptorHandler extends WebMvcConfigurerAdapter {


    @Bean
    HomeResourceInterceptor homeResourceInterceptor(){
        return new HomeResourceInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(homeResourceInterceptor()).addPathPatterns("/**").excludePathPatterns("/admin/**","/login");
        super.addInterceptors(registry);
    }




}
